package com.sparrow.source.common.dto.convert;

import com.sparrow.source.persistense.FyUser;
import com.sparrow.source.persistense.IasUser;
import org.apache.commons.compress.utils.Lists;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @author bryceyung
 * @since 2024/11/19
 */
@Component
public class IasUserConvert {

    public List<IasUser> convertIasUserBatch(List<FyUser> feiYouUserList) {
        List<IasUser> iasUsers = Lists.newArrayList();
        feiYouUserList.forEach(data -> {
            iasUsers.add(convertIasUser(data));
        });
        return iasUsers;
    }

    public IasUser convertIasUser(FyUser feiYouUser) {
        IasUser iasUser = new IasUser();
        iasUser.setName(feiYouUser.getTruename());
        iasUser.setTel(feiYouUser.getTel());
        iasUser.setSyncTime(new Date());
        iasUser.setUid(feiYouUser.getUid());
        iasUser.setPersonId(Long.valueOf(String.valueOf(feiYouUser.getUid())));
        return iasUser;
    }

}
